package com.careerraiser.testing;

import java.lang.ref.WeakReference;
import java.util.ArrayList;

import com.careerraiser.parent.Animal;
import com.careerraiser.child.DoberMan;

public class MemoryTest {
public static void main(String[] args){
	int counter=0;
	ArrayList<WeakReference<DoberMan>> anList = new ArrayList<WeakReference<DoberMan>>();
	ArrayList<Animal> anList1 = new ArrayList<Animal>();

	while (true){
		System.out.println("counter is"+counter++);
		/*try {
			Thread.sleep(1);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/
		if(counter%2==1)
			anList.add(new WeakReference<DoberMan>(new DoberMan("test",10,100)));
		else
			anList1.add(new DoberMan("test1",10,100));

		
		/*if(counter%1000==0){
			//1323854
			System.out.println("Counter-------"+counter);
			//anList.remove(counter-10);
			anList.remove(counter-11);
			anList.remove(counter-12);
			anList.remove(counter-13);
			anList.remove(counter-14);
			anList.remove(counter-15);
		}*/
	}
}
}
